package cn.gok.springboot.controller;

import cn.gok.springboot.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private User user;
    ModelAndView md=new ModelAndView();
    @RequestMapping("/login")
    public ModelAndView login(@RequestParam String username,String password){
        md.addObject("user",user);
        md.setViewName("userlogin");
        if(user.getUserName().equals(username)&&user.getPassWord().equals(password)){
            System.out.println("登录成功");
        }
        System.out.println("登陆失败");

        return md;
    }

}
